local thbattle__youxiang_shinv = fk.CreateSkill {

  name = "thbattle__youxiang_shinv",

  tags = {  },

}



thbattle__youxiang_shinv:addEffect(fk.Death, {
  anim_type = "offensive",
  prompt = "#thbattle__youxiang_nilin_shinv",
  can_trigger = function(self, event, target, player, data)
    return target ~= player and player:hasSkill(thbattle__youxiang_shinv.name) and data.damage and data.damage.from and
        data.damage.from == player
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targetplayer = room:askForChoosePlayers(player,
      table.map(table.filter(room:getOtherPlayers(player), function(p)
        return player:inMyAttackRange(p)
      end), Util.IdMapper), 1, 1, "#thbattle__youxiang_nilin_shinv-choose_player", thbattle__youxiang_shinv.name, true)
    if #targetplayer > 0 then
      room:damage({
        from = player,
        to = room:getPlayerById(targetplayer[1]),
        damage = 1,
        skillName = thbattle__youxiang_shinv.name
      })
    end
  end
})

thbattle__youxiang_shinv:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  prompt = "#thbattle__youxiang_nilin_shinv_damage-prompt",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(thbattle__youxiang_shinv.name) and data.to.hp == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.damage = (data.damage or 0) + 1
  end
})

return thbattle__youxiang_shinv